package com.zzyl.mapper;

import com.github.pagehelper.Page;
import com.zzyl.dto.UserDto;
import com.zzyl.entity.User;
import com.zzyl.entity.UserRole;
import com.zzyl.vo.UserVo;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;
import java.util.Set;

@Mapper
public interface UserMapper {
    Page<UserVo> page(UserDto user);

    @MapKey("id")
    List<Map<String,String>> selectRoleLabels(Long id);

    void insert(User user);

    void batchInserts(List<UserRole> userRoleList);

    void update(User user);
    @Delete("delete from sys_user_role where user_id = #{id}")
    void deleteByUserId(Long id);

    @Update("update sys_user set data_state = #{status} where id = #{id}")
    void isEnable(@Param("id") Long id,@Param("status") Integer status);

    @Delete("delete from sys_user where id = #{userIds}")
    void delete(Long userIds);

    @Select("select * from sys_user where username = #{username}")
    UserVo getByUserName(String username);

    List<UserVo> list(UserDto userDto);
}
